﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data;
using DataObjects;
//using Sql.Data.SqlClient;
using System.Data.SqlClient;

/// <summary>
/// Summary description for MainDAL
/// </summary>
public class BaseDAL
{
	public BaseDAL()
	{
		
	}
	public DataSet RunProcedure(string[] uspParaName, object[] uspParaValue, string uspName)
	{
		DataSet ret = null;
		try
		{
			DbObject db = new DbObject();
            
			int i = uspParaName.Length;
			SqlParameter[] paras = new SqlParameter[i];
			for (int j = 0; j < i; j++)
			{
				paras[j] = new SqlParameter(uspParaName[j], uspParaValue[j]);
			}
			ret = db.RunProcedure(uspName, paras, "table0");
		}
		catch (Exception ex)
		{
			throw new Exception("BaseDAL.RunProcedure(): StoreName: " + uspName + " ### " + ex.ToString());
		}
		return ret;
	}
	public DataSet RunQuery(string query)
	{
		DataSet ds = null;

		DbObject db = new DbObject();
		ds = db.RunQuery(query, "table0");

		return ds;
	}
}